﻿Public Class frmNewGame

    Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        lblEnterName.Show()
        lblPlyr1.Show()
        txtPlyr1.Show()
        If ComboBox1.SelectedIndex = 0 Then
            lblPlyr2.Hide()
            txtPlyr2.Hide()
        End If

        If ComboBox1.SelectedIndex = 1 Then
            lblPlyr2.Show()
            txtPlyr2.Show()
        End If
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        If ComboBox1.SelectedIndex = -1 Then
            MsgBox("Please choose a type of game!")
            Exit Sub
        End If
        If ComboBox1.SelectedIndex = 0 Then
            If txtPlyr1.Text = "" Then
                MsgBox("Please enter a name!")
                Exit Sub
            Else
                Form1.player1Name = txtPlyr1.Text
                Form1.numPlayers = 1
            End If
        End If

        If ComboBox1.SelectedIndex = 1 Then
            If txtPlyr1.Text = "" Then
                MsgBox("Please enter a name!")
                Exit Sub
            Else
                If txtPlyr2.Text = "" Then
                    MsgBox("Please enter a name!")
                    Exit Sub
                Else
                    Form1.player1Name = txtPlyr1.Text
                    Form1.player2Name = txtPlyr2.Text
                    Form1.numPlayers = 2
                End If
            End If
        End If
        Form1.ValidatePlayerName()
        Me.Close()
    End Sub
End Class